<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="__PUBLIC__/echarts/echarts.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
</head>

<body>
<div class="layui-fluid main">
    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
        <div class="layui-form-item" style="float: left;">
            <form class="layui-form serch" action="/admin/product/recyclelist" method="post">
                <div class="layui-form-item" style="float: left;">
                    <div class="layui-input-inline">
                        <input type="hidden" name="use_type" value="1">
                        <input type="text" name="tripname" lay-verify="title" value="{if isset($wherelist['tripname'])}{$wherelist['tripname']}{/if}" autocomplete="off" placeholder="请输入原产品名称/CODE" class="layui-input layui-btn-sm">
                    </div>

                    <div class="layui-input-inline">
                        <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">搜索</button>
                        <a href="{:url('admin/product/index')}" class="layui-btn layui-btn-normal layui-btn-sm">返回</a>
                    </div>
                </div>
            </form>
        </div>
    </fieldset>
    <table class="layui-table" lay-even="" lay-skin="line">
        <colgroup>
            <col width="50">
            <col width="50">
            <col width="100">
            <col width="100">
            <col width="100">
            <col width="100">
            <col width="50">
        </colgroup>
        <thead>
        <tr>
            <th>ID</th>
            <th>原产品ID</th>
            <th>产品名称</th>
            <th>产品code</th>
            <th>修改时间</th>
            <th>最后修改人</th>
            <th>普通操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="product" id="vo"}
        <tr>
            <td>{$vo.id}</td>
            <td>{$vo.old_id}</td>
            <td><strong>{$vo.name}</strong></td>
            <td>{$vo.code}</td>

            <td>{$vo.update_time}</td>
            <td>{$vo.update_admin}</td>

            <td class="operation-menu">
                <a class="layui-btn layui-btn-xs recycle"  codeid="{$vo.id}" style="font-size:14px;">还原</a>
            </td>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div>{$product->render()}</div>
    <div id="checkBox" style="display:none;">
        <style>
            .isok,.notok{
                font-size: 24px;line-height:24px;
            }
            .isok{
                color: #4caf50;
            }
            .notok{
                color: #ff5722;
            }
        </style>
        <div class="layui-row">
            <!--基础信息-->
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div class="box">
                            <div style="margin-left:20px;">
                                <form class="layui-form" id="checkInfo">

                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>
    <script type="text/javascript">
        layui.use(['layer', 'form'], function(){
            var layer = layui.layer;
            var form = layui.form;
            $('.recycle').click(function(){
                var id = $(this).attr('codeid');
                layer.confirm('确定要还原吗?', function(index) {
                    $.ajax({
                        url:"{:url('admin/product/recycle')}",
                        data:{id:id},
                        type:'POST',
                        dataType:'json',
                        success:function(res) {
                            layer.msg(res.msg);
                            if(res.code == 1) {
                                setTimeout(function(){
                                    location.reload();
                                },1500)
                            }
                        }
                    })
                })
            });
        })
    </script>
</div>
</body>
</html>
